<?php
/**
 * @package WordPress
 * @subpackage Franklin_Street
 */
?>
<?php get_header(); ?>
<div id="content" class="home clearfix">
	<div id="content_primary" class='span-7 clearfix'>
		<div class="header">
			<h2><?php if (function_exists("primaryColumnTitle")) primaryColumnTitle(); ?></h2>
			<small><?php if (function_exists("primaryColumnCaption")) primaryColumnCaption(); ?></small> 
		</div>
			<?php
			static $counter = 0;
			if(count(get_option('sticky_posts'))) :
			query_posts( array( 'post__in'=>get_option('sticky_posts') ) );
			if(have_posts()) : while(have_posts()&&$counter<getPrimaryColumnCategories()) : the_post();
			?>			
				<div <?php post_class(($counter == 0) ? 'primary':'secondary'); ?> id="p<?php the_ID(); ?>">
					<div class="article_header">
						<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
						<h4>Posted on <?php the_time('j F, Y g:ia'); ?> | <?php comments_popup_link('no comments', '1 comment', '% comments'); ?>.</h4>							
					</div>
					<div class="entry">
						<?php the_content('Read the rest of this post...'); ?>
					</div>
				</div>
				 <hr <?php if($counter==0) : ?>id="primary_post_divider"<?php endif; ?> />
			<?php $counter++; ?>
			<?php endwhile; else : ?>
				<div class="post">
					<div class="article_header">
						<h3>No Posts Yet</h3>
					</div>
				</div>
			<?php endif; endif; ?>
			<?php wp_reset_query(); ?>
		
			<?php 				
			
			query_posts(array( 'cat' => getPrimaryColumnCategories(),  'showposts' => max(0, getPrimaryColumnPostCount()-$counter) ));
			if(have_posts()) : while(have_posts()) : the_post();
			?>			
				<div <?php post_class(($counter == 0) ? 'primary':'secondary'); ?> id="p<?php the_ID(); ?>">
					<div class="article_header">
						<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
						<h4>Posted on <?php the_time('j F, Y g:ia'); ?> | <?php comments_popup_link('no comments', '1 comment', '% comments'); ?>.</h4>							
					</div>
					<div class="entry">
						<?php the_content('Read the rest of this post...'); ?>
					</div>
				</div>
				 <hr <?php if($counter==0) : ?>id="primary_post_divider"<?php endif; ?> />
			<?php $counter++; ?>
			<?php endwhile; else : ?>
				<div class="post">
					<div class="article_header">
						<h3>No Posts Yet</h3>
					</div>
				</div>
			<?php endif; ?>
			<?php wp_reset_query(); ?>
	</div>

	<div id="content_secondary" class='span-4 clearfix'>
		<div class="header">
			<h2><?php if (function_exists("secondaryColumnTitle")) secondaryColumnTitle(); ?></h2>
			<small><?php if (function_exists("secondaryColumnCaption")) secondaryColumnCaption(); ?></small>
		</div>
		
		<?php 
		query_posts('caller_get_posts=1&cat='.getSecondaryColumnCategories().'&showposts='.getSecondaryColumnPostCount());
		$posts = get_posts('caller_get_posts=1&category='.getSecondaryColumnCategories().'&numberposts='.getSecondaryColumnPostCount().'&offset=0'); 
		if(count($posts)>0) : foreach ($posts as $post) : start_wp(); 
		?>
			<div <?php post_class(($counter == 0) ? 'primary':'secondary'); ?> id="p<?php the_ID(); ?>">
				<div class="article_header">
					<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
					<h4><?php the_time('g:ia, j-m-Y'); ?> | <?php comments_popup_link('no comments', '1 comment', '% comments'); ?>.</h4>
				</div>
				<div class="entry">
					<?php the_content('Read more...'); ?>
				</div>
			</div>
			<hr />
		<?php endforeach; else : ?>
			<div class="post">
				<div class="article_header">
					<h3>No Posts Yet</h3>
				</div>
			</div>
		<?php endif; ?>
		<?php wp_reset_query(); ?>
	</div>
	
	<div id="content_tertiary" class='span-3 clearfix last'>
		<div class="header">
			<h2><?php if (function_exists("tertiaryColumnTitle")) tertiaryColumnTitle(); ?></h2>
			<small><?php if (function_exists("tertiaryColumnCaption")) tertiaryColumnCaption(); ?></small>
		</div>	
		<?php 
		
		query_posts('caller_get_posts=1&cat='.getTertiaryColumnCategories().'&showposts='.getTertiaryColumnPostCount());
		$posts = get_posts('caller_get_posts=1&category='.getTertiaryColumnCategories().'&numberposts='.getTertiaryColumnPostCount().'&offset=0'); 
		if(count($posts)>0) : foreach ($posts as $post) : start_wp(); 
		?>
			<div <?php post_class(($counter == 0) ? 'primary':'secondary'); ?> id="p<?php the_ID(); ?>">
				<div class="entry">
					<?php the_content('Read more...'); ?>
				</div>
				<small class="permalink"><a href="<?php the_permalink(); ?>">Permalink</a></small>
			</div>
			<hr />
		<?php endforeach; else : ?>
			<div class="post">
				<div class="article_header">
					<h3>No Posts Yet</h3>
				</div>
			</div>
		<?php endif; ?>
		<?php wp_reset_query(); ?>
	</div>
</div>
<?php get_footer(); ?>